function main( pp, hh ) {
  
  

  /*
  var add = "http://www.askgeo.com/api/762007/tfgb4hm7h4c9iq2j8avpv40foo/";
  var p = "timezone.json?points=37.7,40.71";
  */
   var userObject = hh.getQueryParameters().getFirst("json");
   Log.debug(userObject);
   if ( userObject == null ){
        var ex = "{ exception: { message: 'no param provided'} }";
        return ex;
  }
  
  
  
 
 /*   
  var json = {
  "title": "1 - Questionnaire",
  "oldTitle": "1 - Questionnaire",
  "questions": [
    {
      "title": "test",
      "oldTitle": "test",
      "input": {
        "hint": "Insert hint field",
        "inputType": "TEXT",
        "name": "Insert field name",
        "type": "INPUT",
        "actions": []
      }
    }
  ]
}
*/
  
 // var jsonObject = new JSONObject(json);
  return createTransaction( userObject );
  
  
}



function createTransaction( o ) {
 
  var t = new TransactionEntity();
  var exception = "";
  t.userId='MIVR';
  t.userAgent='MIVR';
  t.longDate = new java.util.Date().getTime();
  t.type = 'MIVR';
  t.subType = 'MIVR';
  t.refId = 'MIVR';
  t.lat = 0;
  t.lng = 0;
  t.attributes = (o);
  //t.attributes = toJSON( { lat: o.getDouble("lat"), lng: o.getDouble("lng") } );
  
  try{
      EntityManager.createTransaction( t );
  } catch( e ){
       
        return "{'exception':{'code':3,'message':'Error creating transaction','cause':" + e.getMessage() + "}}"
  }
  
  return toJSON( t );
  
  

}


